const express = require("express");
const bodyParser = require('body-parser');
const userRouter = require('./routes/user.js');
//const productRouter = require('./router/product.js');
const app = express();
app.listen(8080);


app.use( bodyParser.urlencoded({
	extended:false
}));
app.use( express.static('public'));

app.use('/v1/users',userRouter);

//添加错误处理中间件,拦截所有产生的错误
app.use( (err,req,res,next)=>{
	//console.log(err);
	res.send({code:500,msg:'服务器错误'});
});